using ConfigurationSettings;
using System;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using ServiceLocator;

namespace CustomControls.UserControls
{
    public partial class UserControlDirectoryColors : UserControlBase
    {
        ColorDialog _colorDialog1;
        FontDialog _fontDialog1;

        public UserControlDirectoryColors()
        {
            InitializeComponent();
        }

        public override void Initialize()
        {
            _colorDialog1 = new ColorDialog
                {
                    AllowFullOpen = true,
                    AnyColor = true,
                    FullOpen = true,
                    SolidColorOnly = true,
                    ShowHelp = false
                };

            _fontDialog1 = new FontDialog
                {
                    ShowApply = false,
                    ShowEffects = true,
                    AllowScriptChange = true,
                    AllowVerticalFonts = false,
                    ScriptsOnly = false,
                    FixedPitchOnly = false,
                    AllowSimulations = true,
                    AllowVectorFonts = true,
                    FontMustExist = true,
                    ShowColor = true,
                    MaxSize = 10
                };

            //_configSettings = new ApplicationSettings();

            #region ** Item Colors **

            IApplicationSettings localSettings = Locator.Resolve<IApplicationSettings>();

            buttonItemNameColor1.BackColor = localSettings.DirectorySettings.PlainSettings.NameColors.Color1;
            buttonItemNameColor2.BackColor = localSettings.DirectorySettings.PlainSettings.NameColors.Color2;
            spinnerItemNameAngle.Value = (decimal)localSettings.DirectorySettings.PlainSettings.NameColors.Direction;

            buttonItemSizeColor1.BackColor = localSettings.DirectorySettings.PlainSettings.SizeColors.Color1;
            buttonItemSizeColor2.BackColor = localSettings.DirectorySettings.PlainSettings.SizeColors.Color2;
            spinnerItemSizeAngle.Value = (decimal)localSettings.DirectorySettings.PlainSettings.SizeColors.Direction;

            buttonItemDateColor1.BackColor = localSettings.DirectorySettings.PlainSettings.DateColors.Color1;
            buttonItemDateColor2.BackColor = localSettings.DirectorySettings.PlainSettings.DateColors.Color2;
            spinnerItemDateAngle.Value = (decimal)localSettings.DirectorySettings.PlainSettings.DateColors.Direction;

            #endregion

            #region ** Item Selected Colors **

            buttonSelectedItemNameColor1.BackColor = localSettings.DirectorySettings.SelectedSettings.NameColors.Color1;
            buttonSelectedItemNameColor2.BackColor = localSettings.DirectorySettings.SelectedSettings.NameColors.Color2;
            spinnerSelectedItemNameAngle.Value = (decimal)localSettings.DirectorySettings.SelectedSettings.NameColors.Direction;

            buttonSelectedItemSizeColor1.BackColor = localSettings.DirectorySettings.SelectedSettings.SizeColors.Color1;
            buttonSelectedItemSizeColor2.BackColor = localSettings.DirectorySettings.SelectedSettings.SizeColors.Color2;
            spinnerSelectedItemSizeAngle.Value = (decimal)localSettings.DirectorySettings.SelectedSettings.SizeColors.Direction;

            buttonSelectedItemDateColor1.BackColor = localSettings.DirectorySettings.SelectedSettings.DateColors.Color1;
            buttonSelectedItemDateColor2.BackColor = localSettings.DirectorySettings.SelectedSettings.DateColors.Color2;
            spinnerSelectedItemDateAngle.Value = (decimal)localSettings.DirectorySettings.SelectedSettings.DateColors.Direction;

            #endregion

            #region ** Item MouseOver Colors **
            //TO DO:000 - Implement MouseOver Colors
            buttonItemMouseOverNameColor1.BackColor = localSettings.DirectorySettings.MouseOverSettings.NameColors.Color1;
            buttonItemMouseOverNameColor2.BackColor = localSettings.DirectorySettings.MouseOverSettings.NameColors.Color2;
            spinnerItemMouseOverNameAngle.Value = (decimal)localSettings.DirectorySettings.MouseOverSettings.NameColors.Direction;

            buttonItemMouseOverSizeColor1.BackColor = localSettings.DirectorySettings.MouseOverSettings.SizeColors.Color1;
            buttonItemMouseOverSizeColor2.BackColor = localSettings.DirectorySettings.MouseOverSettings.SizeColors.Color2;
            spinnerItemMouseOverSizeAngle.Value = (decimal)localSettings.DirectorySettings.MouseOverSettings.SizeColors.Direction;

            buttonItemMouseOverDateColor1.BackColor = localSettings.DirectorySettings.MouseOverSettings.DateColors.Color1;
            buttonItemMouseOverDateColor2.BackColor = localSettings.DirectorySettings.MouseOverSettings.DateColors.Color2;
            spinnerItemMouseOverDateAngle.Value = (decimal)localSettings.DirectorySettings.MouseOverSettings.DateColors.Direction;

            #endregion

            #region ** Item Selected MouseOver Colors **
            //Implement Selected MouseOver Colors
            buttonSelectedItemMouseOverNameColor1.BackColor = localSettings.DirectorySettings.SelectedMouseOverSettings.NameColors.Color1;
            buttonSelectedItemMouseOverNameColor2.BackColor = localSettings.DirectorySettings.SelectedMouseOverSettings.NameColors.Color2;
            spinnerSelectedItemMouseOverNameAngle.Value = (decimal)localSettings.DirectorySettings.SelectedMouseOverSettings.NameColors.Direction;

            buttonSelectedItemMouseOverSizeColor1.BackColor = localSettings.DirectorySettings.SelectedMouseOverSettings.SizeColors.Color1;
            buttonSelectedItemMouseOverSizeColor2.BackColor = localSettings.DirectorySettings.SelectedMouseOverSettings.SizeColors.Color2;
            spinnerSelectedItemMouseOverSizeAngle.Value = (decimal)localSettings.DirectorySettings.SelectedMouseOverSettings.SizeColors.Direction;

            buttonSelectedItemMouseOverDateColor1.BackColor = localSettings.DirectorySettings.SelectedMouseOverSettings.DateColors.Color1;
            buttonSelectedItemMouseOverDateColor2.BackColor = localSettings.DirectorySettings.SelectedMouseOverSettings.DateColors.Color2;
            spinnerSelectedItemMouseOverDateAngle.Value = (decimal)localSettings.DirectorySettings.SelectedMouseOverSettings.DateColors.Direction;

            #endregion

            #region ** Background Colors **

            fslviDemo1.BackColor = localSettings.ListViewBackColor;
            fslviDemo2.BackColor = localSettings.ListViewBackColor;
            fslviDemo3.BackColor = localSettings.ListViewBackColor;

            pictureBoxBackground.BackColor = localSettings.ListViewBackColor;

            #endregion

            #region ** Fonts **

            fslviDemo1.Font = localSettings.DirectorySettings.PlainSettings.Font;// PlainDirectoryFont;
            fslviDemo2.Font = localSettings.DirectorySettings.PlainSettings.Font;// PlainDirectoryFont;
            fslviDemo3.Font = localSettings.DirectorySettings.PlainSettings.Font;// PlainDirectoryFont;

            fslviDemo1.ForeColor = localSettings.DirectorySettings.PlainSettings.FontColor;// PlainDirectoryForeColor;
            fslviDemo2.ForeColor = localSettings.DirectorySettings.PlainSettings.FontColor;// PlainDirectoryForeColor;
            fslviDemo3.ForeColor = localSettings.DirectorySettings.PlainSettings.FontColor;// PlainDirectoryForeColor;

            fslviDemo1.SelectedFont = localSettings.DirectorySettings.SelectedSettings.Font;// SelectedDirectoryFont;
            fslviDemo2.SelectedFont = localSettings.DirectorySettings.SelectedSettings.Font;// SelectedDirectoryFont;
            fslviDemo3.SelectedFont = localSettings.DirectorySettings.SelectedSettings.Font;// SelectedDirectoryFont;

            fslviDemo1.SelectedForeColor = localSettings.DirectorySettings.SelectedSettings.FontColor;// SelectedDirectoryForeColor;
            fslviDemo2.SelectedForeColor = localSettings.DirectorySettings.SelectedSettings.FontColor;// SelectedDirectoryForeColor;
            fslviDemo3.SelectedForeColor = localSettings.DirectorySettings.SelectedSettings.FontColor;// SelectedDirectoryForeColor;

            fslviDemo1.MouseOverFont = localSettings.DirectorySettings.MouseOverSettings.Font;// MouseOverDirectoryFont;
            fslviDemo2.MouseOverFont = localSettings.DirectorySettings.MouseOverSettings.Font;// MouseOverDirectoryFont;
            fslviDemo3.MouseOverFont = localSettings.DirectorySettings.MouseOverSettings.Font;// MouseOverDirectoryFont;

            fslviDemo1.MouseOverForeColor = localSettings.DirectorySettings.MouseOverSettings.FontColor;// MouseOverDirectoryForeColor;
            fslviDemo2.MouseOverForeColor = localSettings.DirectorySettings.MouseOverSettings.FontColor;// MouseOverDirectoryForeColor;
            fslviDemo3.MouseOverForeColor = localSettings.DirectorySettings.MouseOverSettings.FontColor;// MouseOverDirectoryForeColor;

            fslviDemo1.SelectedMouseOverFont = localSettings.DirectorySettings.SelectedMouseOverSettings.Font;// SelectedMouseOverDirectoryFont;
            fslviDemo2.SelectedMouseOverFont = localSettings.DirectorySettings.SelectedMouseOverSettings.Font;// SelectedMouseOverDirectoryFont;
            fslviDemo3.SelectedMouseOverFont = localSettings.DirectorySettings.SelectedMouseOverSettings.Font;// SelectedMouseOverDirectoryFont;

            fslviDemo1.SelectedMouseOverForeColor = localSettings.DirectorySettings.SelectedMouseOverSettings.FontColor;// SelectedMouseOverDirectoryForeColor;
            fslviDemo2.SelectedMouseOverForeColor = localSettings.DirectorySettings.SelectedMouseOverSettings.FontColor;// SelectedMouseOverDirectoryForeColor;
            fslviDemo3.SelectedMouseOverForeColor = localSettings.DirectorySettings.SelectedMouseOverSettings.FontColor;// SelectedMouseOverDirectoryForeColor;

            #endregion

            PaintSampleBoxes();

            DirtyFlag = false;

        }

        private void buttonColor_Click(object argSender, EventArgs argEventArgs)
        {
            Control currentButton = (Control)argSender;

            //Add any custom colors.

            _colorDialog1.CustomColors = tableLayoutPanelNameColors.Controls.OfType<DragColorButton>().Select(argCurrentControl => CorrectedColor.CorrectColor(argCurrentControl.BackColor)).ToArray();

            _colorDialog1.Color = currentButton.BackColor;

            //On a "Cancel" the dialog color will remain the same.
            _colorDialog1.ShowDialog(this);
            currentButton.BackColor = _colorDialog1.Color;
        }

        private void numericUpDownAngle_ValueChanged(object argSender, EventArgs argEventArgs)
        {
            //NumericUpDown CurrentControl = (NumericUpDown)sender;

            PaintSampleBoxes();
        }

        private void buttonPlainDirectoryFontDialog_Click(object argSender, EventArgs argEventArgs)
        {
            _fontDialog1.Font = fslviDemo1.Font;
            _fontDialog1.Color = fslviDemo1.ForeColor;

            _fontDialog1.ShowDialog();

            Font currentFont = _fontDialog1.Font;
            Color currentFontColor = _fontDialog1.Color;

            fslviDemo1.Font = currentFont;
            fslviDemo1.ForeColor = currentFontColor;

            fslviDemo2.Font = currentFont;
            fslviDemo2.ForeColor = currentFontColor;

            fslviDemo3.Font = currentFont;
            fslviDemo3.ForeColor = currentFontColor;

            PaintSampleBoxes();
        }

        private void buttonSelectedDirectoryFontDialog_Click(object argSender, EventArgs argEventArgs)
        {
            _fontDialog1.Font = fslviDemo1.SelectedFont;
            _fontDialog1.Color = fslviDemo1.SelectedForeColor;

            _fontDialog1.ShowDialog();

            Font currentFont = _fontDialog1.Font;
            Color currentFontColor = _fontDialog1.Color;

            fslviDemo1.SelectedFont = currentFont;
            fslviDemo1.SelectedForeColor = currentFontColor;

            fslviDemo2.SelectedFont = currentFont;
            fslviDemo2.SelectedForeColor = currentFontColor;

            fslviDemo3.SelectedFont = currentFont;
            fslviDemo3.SelectedForeColor = currentFontColor;

            PaintSampleBoxes();
        }

        private void buttonMouseOverDirectoryFontDialog_Click(object argSender, EventArgs argEventArgs)
        {
            _fontDialog1.Font = fslviDemo1.MouseOverFont;
            _fontDialog1.Color = fslviDemo1.MouseOverForeColor;

            _fontDialog1.ShowDialog();

            Font currentFont = _fontDialog1.Font;
            Color currentFontColor = _fontDialog1.Color;

            fslviDemo1.MouseOverFont = currentFont;
            fslviDemo1.MouseOverForeColor = currentFontColor;

            fslviDemo2.MouseOverFont = currentFont;
            fslviDemo2.MouseOverForeColor = currentFontColor;

            fslviDemo3.MouseOverFont = currentFont;
            fslviDemo3.MouseOverForeColor = currentFontColor;

            PaintSampleBoxes();

        }

        private void buttonSelectedMouseOverDirectoryFontDialog_Click(object argSender, EventArgs argEventArgs)
        {
            _fontDialog1.Font = fslviDemo1.SelectedMouseOverFont;
            _fontDialog1.Color = fslviDemo1.SelectedMouseOverForeColor;

            _fontDialog1.ShowDialog();

            Font currentFont = _fontDialog1.Font;
            Color currentFontColor = _fontDialog1.Color;

            fslviDemo1.SelectedMouseOverFont = currentFont;
            fslviDemo1.SelectedMouseOverForeColor = currentFontColor;

            fslviDemo2.SelectedMouseOverFont = currentFont;
            fslviDemo2.SelectedMouseOverForeColor = currentFontColor;

            fslviDemo3.SelectedMouseOverFont = currentFont;
            fslviDemo3.SelectedMouseOverForeColor = currentFontColor;

            PaintSampleBoxes();
        }

        private void button_BackColorChanged(object argSender, EventArgs argEventArgs)
        {
            Control currentControl = (Control)argSender;
            string toolTipString = String.Format("[ R={0}, G={1}, B={2}]", currentControl.BackColor.R, currentControl.BackColor.G, currentControl.BackColor.B);
            toolTip1.SetToolTip(currentControl, toolTipString);

            PaintSampleBoxes();
        }

        private void PaintSampleBoxes()
        {

            #region ** Item Colors **

            //Name
            //---------------------------------------------------------------------
            fslviDemo1.PlainNameColor1 = buttonItemNameColor1.BackColor;
            fslviDemo1.PlainNameColor2 = buttonItemNameColor2.BackColor;
            fslviDemo1.PlainNameDirection = (float)spinnerItemNameAngle.Value;
            fslviDemo2.PlainNameColor1 = buttonItemNameColor1.BackColor;
            fslviDemo2.PlainNameColor2 = buttonItemNameColor2.BackColor;
            fslviDemo2.PlainNameDirection = (float)spinnerItemNameAngle.Value;
            fslviDemo3.PlainNameColor1 = buttonItemNameColor1.BackColor;
            fslviDemo3.PlainNameColor2 = buttonItemNameColor2.BackColor;
            fslviDemo3.PlainNameDirection = (float)spinnerItemNameAngle.Value;
            //---------------------------------------------------------------------

            //Size
            //---------------------------------------------------------------------
            fslviDemo1.PlainSizeColor1 = buttonItemSizeColor1.BackColor;
            fslviDemo1.PlainSizeColor2 = buttonItemSizeColor2.BackColor;
            fslviDemo1.PlainSizeDirection = (float)spinnerItemSizeAngle.Value;
            fslviDemo2.PlainSizeColor1 = buttonItemSizeColor1.BackColor;
            fslviDemo2.PlainSizeColor2 = buttonItemSizeColor2.BackColor;
            fslviDemo2.PlainSizeDirection = (float)spinnerItemSizeAngle.Value;
            fslviDemo3.PlainSizeColor1 = buttonItemSizeColor1.BackColor;
            fslviDemo3.PlainSizeColor2 = buttonItemSizeColor2.BackColor;
            fslviDemo3.PlainSizeDirection = (float)spinnerItemSizeAngle.Value;
            //---------------------------------------------------------------------

            //Date
            //---------------------------------------------------------------------
            fslviDemo1.PlainDateColor1 = buttonItemDateColor1.BackColor;
            fslviDemo1.PlainDateColor2 = buttonItemDateColor2.BackColor;
            fslviDemo1.PlainDateDirection = (float)spinnerItemDateAngle.Value;
            fslviDemo2.PlainDateColor1 = buttonItemDateColor1.BackColor;
            fslviDemo2.PlainDateColor2 = buttonItemDateColor2.BackColor;
            fslviDemo2.PlainDateDirection = (float)spinnerItemDateAngle.Value;
            fslviDemo3.PlainDateColor1 = buttonItemDateColor1.BackColor;
            fslviDemo3.PlainDateColor2 = buttonItemDateColor2.BackColor;
            fslviDemo3.PlainDateDirection = (float)spinnerItemDateAngle.Value;
            //---------------------------------------------------------------------

            #endregion

            #region ** Selected Item Colors **

            //Name
            //---------------------------------------------------------------------
            fslviDemo1.SelectedNameColor1 = buttonSelectedItemNameColor1.BackColor;
            fslviDemo1.SelectedNameColor2 = buttonSelectedItemNameColor2.BackColor;
            fslviDemo1.SelectedNameDirection = (float)spinnerSelectedItemNameAngle.Value;
            fslviDemo2.SelectedNameColor1 = buttonSelectedItemNameColor1.BackColor;
            fslviDemo2.SelectedNameColor2 = buttonSelectedItemNameColor2.BackColor;
            fslviDemo2.SelectedNameDirection = (float)spinnerSelectedItemNameAngle.Value;
            fslviDemo3.SelectedNameColor1 = buttonSelectedItemNameColor1.BackColor;
            fslviDemo3.SelectedNameColor2 = buttonSelectedItemNameColor2.BackColor;
            fslviDemo3.SelectedNameDirection = (float)spinnerSelectedItemNameAngle.Value;
            //---------------------------------------------------------------------

            //Size
            //---------------------------------------------------------------------
            fslviDemo1.SelectedSizeColor1 = buttonSelectedItemSizeColor1.BackColor;
            fslviDemo1.SelectedSizeColor2 = buttonSelectedItemSizeColor2.BackColor;
            fslviDemo1.SelectedSizeDirection = (float)spinnerSelectedItemSizeAngle.Value;
            fslviDemo2.SelectedSizeColor1 = buttonSelectedItemSizeColor1.BackColor;
            fslviDemo2.SelectedSizeColor2 = buttonSelectedItemSizeColor2.BackColor;
            fslviDemo2.SelectedSizeDirection = (float)spinnerSelectedItemSizeAngle.Value;
            fslviDemo3.SelectedSizeColor1 = buttonSelectedItemSizeColor1.BackColor;
            fslviDemo3.SelectedSizeColor2 = buttonSelectedItemSizeColor2.BackColor;
            fslviDemo3.SelectedSizeDirection = (float)spinnerSelectedItemSizeAngle.Value;
            //---------------------------------------------------------------------

            //Date
            //---------------------------------------------------------------------
            fslviDemo1.SelectedDateColor1 = buttonSelectedItemDateColor1.BackColor;
            fslviDemo1.SelectedDateColor2 = buttonSelectedItemDateColor2.BackColor;
            fslviDemo1.SelectedDateDirection = (float)spinnerSelectedItemDateAngle.Value;
            fslviDemo2.SelectedDateColor1 = buttonSelectedItemDateColor1.BackColor;
            fslviDemo2.SelectedDateColor2 = buttonSelectedItemDateColor2.BackColor;
            fslviDemo2.SelectedDateDirection = (float)spinnerSelectedItemDateAngle.Value;
            fslviDemo3.SelectedDateColor1 = buttonSelectedItemDateColor1.BackColor;
            fslviDemo3.SelectedDateColor2 = buttonSelectedItemDateColor2.BackColor;
            fslviDemo3.SelectedDateDirection = (float)spinnerSelectedItemDateAngle.Value;
            //---------------------------------------------------------------------

            #endregion

            #region ** Item MouseOver Colors **

            //Name
            //---------------------------------------------------------------------
            fslviDemo1.MouseOverNameColor1 = buttonItemMouseOverNameColor1.BackColor;
            fslviDemo1.MouseOverNameColor2 = buttonItemMouseOverNameColor2.BackColor;
            fslviDemo1.MouseOverNameDirection = (float)spinnerItemMouseOverNameAngle.Value;
            fslviDemo2.MouseOverNameColor1 = buttonItemMouseOverNameColor1.BackColor;
            fslviDemo2.MouseOverNameColor2 = buttonItemMouseOverNameColor2.BackColor;
            fslviDemo2.MouseOverNameDirection = (float)spinnerItemMouseOverNameAngle.Value;
            fslviDemo3.MouseOverNameColor1 = buttonItemMouseOverNameColor1.BackColor;
            fslviDemo3.MouseOverNameColor2 = buttonItemMouseOverNameColor2.BackColor;
            fslviDemo3.MouseOverNameDirection = (float)spinnerItemMouseOverNameAngle.Value;
            //---------------------------------------------------------------------

            //Size
            //---------------------------------------------------------------------
            fslviDemo1.MouseOverSizeColor1 = buttonItemMouseOverSizeColor1.BackColor;
            fslviDemo1.MouseOverSizeColor2 = buttonItemMouseOverSizeColor2.BackColor;
            fslviDemo1.MouseOverSizeDirection = (float)spinnerItemMouseOverSizeAngle.Value;
            fslviDemo2.MouseOverSizeColor1 = buttonItemMouseOverSizeColor1.BackColor;
            fslviDemo2.MouseOverSizeColor2 = buttonItemMouseOverSizeColor2.BackColor;
            fslviDemo2.MouseOverSizeDirection = (float)spinnerItemMouseOverSizeAngle.Value;
            fslviDemo3.MouseOverSizeColor1 = buttonItemMouseOverSizeColor1.BackColor;
            fslviDemo3.MouseOverSizeColor2 = buttonItemMouseOverSizeColor2.BackColor;
            fslviDemo3.MouseOverSizeDirection = (float)spinnerItemMouseOverSizeAngle.Value;
            //---------------------------------------------------------------------

            //Date
            //---------------------------------------------------------------------
            fslviDemo1.MouseOverDateColor1 = buttonItemMouseOverDateColor1.BackColor;
            fslviDemo1.MouseOverDateColor2 = buttonItemMouseOverDateColor2.BackColor;
            fslviDemo1.MouseOverDateDirection = (float)spinnerItemMouseOverDateAngle.Value;
            fslviDemo2.MouseOverDateColor1 = buttonItemMouseOverDateColor1.BackColor;
            fslviDemo2.MouseOverDateColor2 = buttonItemMouseOverDateColor2.BackColor;
            fslviDemo2.MouseOverDateDirection = (float)spinnerItemMouseOverDateAngle.Value;
            fslviDemo3.MouseOverDateColor1 = buttonItemMouseOverDateColor1.BackColor;
            fslviDemo3.MouseOverDateColor2 = buttonItemMouseOverDateColor2.BackColor;
            fslviDemo3.MouseOverDateDirection = (float)spinnerItemMouseOverDateAngle.Value;
            //---------------------------------------------------------------------

            #endregion

            #region ** Selected Item MouseOver Colors **

            //Name
            //---------------------------------------------------------------------
            fslviDemo1.SelectedMouseOverNameColor1 = buttonSelectedItemMouseOverNameColor1.BackColor;
            fslviDemo1.SelectedMouseOverNameColor2 = buttonSelectedItemMouseOverNameColor2.BackColor;
            fslviDemo1.SelectedMouseOverNameDirection = (float)spinnerSelectedItemMouseOverNameAngle.Value;
            fslviDemo2.SelectedMouseOverNameColor1 = buttonSelectedItemMouseOverNameColor1.BackColor;
            fslviDemo2.SelectedMouseOverNameColor2 = buttonSelectedItemMouseOverNameColor2.BackColor;
            fslviDemo2.SelectedMouseOverNameDirection = (float)spinnerSelectedItemMouseOverNameAngle.Value;
            fslviDemo3.SelectedMouseOverNameColor1 = buttonSelectedItemMouseOverNameColor1.BackColor;
            fslviDemo3.SelectedMouseOverNameColor2 = buttonSelectedItemMouseOverNameColor2.BackColor;
            fslviDemo3.SelectedMouseOverNameDirection = (float)spinnerSelectedItemMouseOverNameAngle.Value;
            //---------------------------------------------------------------------

            //Size
            //---------------------------------------------------------------------
            fslviDemo1.SelectedMouseOverSizeColor1 = buttonSelectedItemMouseOverSizeColor1.BackColor;
            fslviDemo1.SelectedMouseOverSizeColor2 = buttonSelectedItemMouseOverSizeColor2.BackColor;
            fslviDemo1.SelectedMouseOverSizeDirection = (float)spinnerSelectedItemMouseOverSizeAngle.Value;
            fslviDemo2.SelectedMouseOverSizeColor1 = buttonSelectedItemMouseOverSizeColor1.BackColor;
            fslviDemo2.SelectedMouseOverSizeColor2 = buttonSelectedItemMouseOverSizeColor2.BackColor;
            fslviDemo2.SelectedMouseOverSizeDirection = (float)spinnerSelectedItemMouseOverSizeAngle.Value;
            fslviDemo3.SelectedMouseOverSizeColor1 = buttonSelectedItemMouseOverSizeColor1.BackColor;
            fslviDemo3.SelectedMouseOverSizeColor2 = buttonSelectedItemMouseOverSizeColor2.BackColor;
            fslviDemo3.SelectedMouseOverSizeDirection = (float)spinnerSelectedItemMouseOverSizeAngle.Value;
            //---------------------------------------------------------------------

            //Date
            //---------------------------------------------------------------------
            fslviDemo1.SelectedMouseOverDateColor1 = buttonSelectedItemMouseOverDateColor1.BackColor;
            fslviDemo1.SelectedMouseOverDateColor2 = buttonSelectedItemMouseOverDateColor2.BackColor;
            fslviDemo1.SelectedMouseOverDateDirection = (float)spinnerSelectedItemMouseOverDateAngle.Value;
            fslviDemo2.SelectedMouseOverDateColor1 = buttonSelectedItemMouseOverDateColor1.BackColor;
            fslviDemo2.SelectedMouseOverDateColor2 = buttonSelectedItemMouseOverDateColor2.BackColor;
            fslviDemo2.SelectedMouseOverDateDirection = (float)spinnerSelectedItemMouseOverDateAngle.Value;
            fslviDemo3.SelectedMouseOverDateColor1 = buttonSelectedItemMouseOverDateColor1.BackColor;
            fslviDemo3.SelectedMouseOverDateColor2 = buttonSelectedItemMouseOverDateColor2.BackColor;
            fslviDemo3.SelectedMouseOverDateDirection = (float)spinnerSelectedItemMouseOverDateAngle.Value;
            //---------------------------------------------------------------------

            #endregion

            DirtyFlag = true;
        }

        public override void OnApply() //object sender, EventArgs argEventArgs)
        {
            if (!DirtyFlag)
            {
                return;
            }

            #region ** Normal Item Colors **

            IApplicationSettings localSettings = Locator.Resolve<IApplicationSettings>();

            //Name Nodes
            localSettings.DirectorySettings.PlainSettings.NameColors.Color1 = buttonItemNameColor1.BackColor;
            localSettings.DirectorySettings.PlainSettings.NameColors.Color2 = buttonItemNameColor2.BackColor;
            localSettings.DirectorySettings.PlainSettings.NameColors.Direction = (float)spinnerItemNameAngle.Value;

            //Size Nodes
            localSettings.DirectorySettings.PlainSettings.SizeColors.Color1 = buttonItemSizeColor1.BackColor;
            localSettings.DirectorySettings.PlainSettings.SizeColors.Color2 = buttonItemSizeColor2.BackColor;
            localSettings.DirectorySettings.PlainSettings.SizeColors.Direction = (float)spinnerItemSizeAngle.Value;

            //Date Nodes
            localSettings.DirectorySettings.PlainSettings.DateColors.Color1 = buttonItemDateColor1.BackColor;
            localSettings.DirectorySettings.PlainSettings.DateColors.Color2 = buttonItemDateColor2.BackColor;
            localSettings.DirectorySettings.PlainSettings.DateColors.Direction = (float)spinnerItemDateAngle.Value;

            #endregion

            #region ** Selected Item Colors **

            //Name Nodes
            localSettings.DirectorySettings.SelectedSettings.NameColors.Color1 = buttonSelectedItemNameColor1.BackColor;
            localSettings.DirectorySettings.SelectedSettings.NameColors.Color2 = buttonSelectedItemNameColor2.BackColor;
            localSettings.DirectorySettings.SelectedSettings.NameColors.Direction = (float)spinnerSelectedItemNameAngle.Value;

            ////Size Nodes
            localSettings.DirectorySettings.SelectedSettings.SizeColors.Color1 = buttonSelectedItemSizeColor1.BackColor;
            localSettings.DirectorySettings.SelectedSettings.SizeColors.Color2 = buttonSelectedItemSizeColor2.BackColor;
            localSettings.DirectorySettings.SelectedSettings.SizeColors.Direction = (float)spinnerSelectedItemSizeAngle.Value;

            ////Date Nodes
            localSettings.DirectorySettings.SelectedSettings.DateColors.Color1 = buttonSelectedItemDateColor1.BackColor;
            localSettings.DirectorySettings.SelectedSettings.DateColors.Color2 = buttonSelectedItemDateColor2.BackColor;
            localSettings.DirectorySettings.SelectedSettings.DateColors.Direction = (float)spinnerSelectedItemDateAngle.Value;

            #endregion

            #region ** MouseOver Item Colors **

            //Name Nodes
            localSettings.DirectorySettings.MouseOverSettings.NameColors.Color1 = buttonItemMouseOverNameColor1.BackColor;
            localSettings.DirectorySettings.MouseOverSettings.NameColors.Color2 = buttonItemMouseOverNameColor2.BackColor;
            localSettings.DirectorySettings.MouseOverSettings.NameColors.Direction = (float)spinnerItemMouseOverNameAngle.Value;

            ////Size Nodes
            localSettings.DirectorySettings.MouseOverSettings.SizeColors.Color1 = buttonItemMouseOverSizeColor1.BackColor;
            localSettings.DirectorySettings.MouseOverSettings.SizeColors.Color2 = buttonItemMouseOverSizeColor2.BackColor;
            localSettings.DirectorySettings.MouseOverSettings.SizeColors.Direction = (float)spinnerItemMouseOverSizeAngle.Value;

            ////Date Nodes
            localSettings.DirectorySettings.MouseOverSettings.DateColors.Color1 = buttonItemMouseOverDateColor1.BackColor;
            localSettings.DirectorySettings.MouseOverSettings.DateColors.Color2 = buttonItemMouseOverDateColor2.BackColor;
            localSettings.DirectorySettings.MouseOverSettings.DateColors.Direction = (float)spinnerItemMouseOverDateAngle.Value;

            #endregion

            #region ** MouseOver Selected Item Colors **

            //Name Nodes
            localSettings.DirectorySettings.SelectedMouseOverSettings.NameColors.Color1 = buttonSelectedItemMouseOverNameColor1.BackColor;
            localSettings.DirectorySettings.SelectedMouseOverSettings.NameColors.Color2 = buttonSelectedItemMouseOverNameColor2.BackColor;
            localSettings.DirectorySettings.SelectedMouseOverSettings.NameColors.Direction = (float)spinnerSelectedItemMouseOverNameAngle.Value;

            //Size Nodes
            localSettings.DirectorySettings.SelectedMouseOverSettings.SizeColors.Color1 = buttonSelectedItemMouseOverSizeColor1.BackColor;
            localSettings.DirectorySettings.SelectedMouseOverSettings.SizeColors.Color2 = buttonSelectedItemMouseOverSizeColor2.BackColor;
            localSettings.DirectorySettings.SelectedMouseOverSettings.SizeColors.Direction = (float)spinnerSelectedItemMouseOverSizeAngle.Value;

            //Date Nodes
            localSettings.DirectorySettings.SelectedMouseOverSettings.DateColors.Color1 = buttonSelectedItemMouseOverDateColor1.BackColor;
            localSettings.DirectorySettings.SelectedMouseOverSettings.DateColors.Color2 = buttonSelectedItemMouseOverDateColor2.BackColor;
            localSettings.DirectorySettings.SelectedMouseOverSettings.DateColors.Direction = (float)spinnerSelectedItemMouseOverDateAngle.Value;

            #endregion

            #region ** Font info **

            localSettings.DirectorySettings.PlainSettings.Font = fslviDemo1.Font;
            localSettings.DirectorySettings.PlainSettings.FontColor = fslviDemo1.ForeColor;

            localSettings.DirectorySettings.SelectedSettings.Font = fslviDemo1.SelectedFont;
            localSettings.DirectorySettings.SelectedSettings.FontColor = fslviDemo1.SelectedForeColor;

            localSettings.DirectorySettings.MouseOverSettings.Font = fslviDemo1.MouseOverFont;
            localSettings.DirectorySettings.MouseOverSettings.FontColor = fslviDemo1.MouseOverForeColor;

            localSettings.DirectorySettings.SelectedMouseOverSettings.Font = fslviDemo1.SelectedMouseOverFont;
            localSettings.DirectorySettings.SelectedMouseOverSettings.FontColor = fslviDemo1.SelectedMouseOverForeColor;

            #endregion

            localSettings.Save();
            DirtyFlag = false;

        }

    }
}
